<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <title>{% block title %}{% endblock %} | {{ g.config.site_title }}</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="keywords" content="{{ g.config.seo_keywords }}">
    <meta name="description" content="{{ g.config.seo_description }}">
    <!-- 引入 Bootstrap -->
    <link href="{{ url_for('static', filename='css/bootstrap.min.css') }}" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="https://static.saintic.com/iconfont/iconfont.min.css">
    <!--<link href="{{ url_for('static', filename='css/font-awesome.min.css') }}" rel="stylesheet">-->
    <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
    <![endif]-->
    <link href="https://static.saintic.com/cdn/images/favicon-32.png" rel="icon" type="image/x-icon" />
    <link href="https://static.saintic.com/cdn/images/favicon-32.png" rel="shortcut icon" type="image/x-icon" />
    <link href="{{ url_for('static', filename='css/style.css') }}" rel="stylesheet">
    <link rel="alternate" type="application/atom+xml" title="{{ g.config.site_feedname }}" href="{{ url_for('front.feed') }}">
    {% block head %}{% endblock %}
    {{ emit_tep("base_front_header") }}
</head>
<body>

<div class="container">

    <div class="row clearfix">
        <div class="col-md-12 column">
            <!--顶部导航-->
            <nav class="navbar navbar-default" role="navigation">
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> <span class="sr-only">Toggle navigation</span><span class="saintic-icon saintic-icon-bars"></span></button> <a class="navbar-brand" href="{{ url_for('.index') }}"><img src="/static/img/logo.png" height="28"></a>
                </div>
                <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                    <ul class="nav navbar-nav">
                        <li><a href="{{ url_for('front.blogWrite') }}" title="Write">创作&nbsp;<i class="saintic-icon saintic-icon-blog saintic-icon-1"></i></a></li>
                        <li><a href="{{ url_for('front.feed') }}" target="_blank" title="Feed">订阅&nbsp;<i class="saintic-icon saintic-icon-rss saintic-icon-1"></i></a></li>
                        <li class="dropdown">
                            <a href="#" title="Catalog" class="dropdown-toggle" data-toggle="dropdown">分类目录&nbsp;<i class="saintic-icon saintic-icon-catalog saintic-icon-1"></i></a>
                            <ul class="dropdown-menu">
                                {% for catalog in g.api.blog_get_catalog_list().data %}
                                <li><a href="{{ url_for('front.blogResource', resource_type='catalog', resource_data=catalog) }}">{{ catalog }}</a></li>
                                {% endfor %}
                                <li class="divider"></li>
                                <li><a href="{{ url_for('front.blogResource', resource_type='sources', resource_data=1) }}">原创</a></li>
                                <li><a href="{{ url_for('front.blogResource', resource_type='sources', resource_data=2) }}">转载</a></li>
                                <li><a href="{{ url_for('front.blogResource', resource_type='sources', resource_data=3) }}">翻译</a></li>
                            </ul>
                        </li>
                        <li class="dropdown">
                                <!--
                                <a href="/read/" title="Novels" class="dropdown-toggle" data-toggle="dropdown">唔，小说&nbsp;<i class="saintic-icon saintic-icon-docs saintic-icon-1"></i></a>
                                <ul class="dropdown-menu">
                                    {% for d in g.api.novel_get_books().data or [] %}
                                    <li><a href="/read/catalog.html?book_id={{ d.book_id}}">{{ d.name }}</a></li>
                                    {% endfor %}
                                </ul>
                                -->
                            </li>
                        {{ emit_tep('base_front_navigation') }}
                    </ul>
                    <ul class="nav navbar-nav navbar-right">
                        {% if g.signin %}
                        <li class="dropdown">
                            <a href="{{ url_for('front.userGo', uid=g.uid) }}" title="User Home" class="dropdown-toggle" data-toggle="dropdown">个人中心&nbsp;<i class="saintic-icon saintic-icon-user saintic-icon-1"></i></a>
                            <ul class="dropdown-menu">
                                <li><a href="{{ url_for('front.userGo', uid=g.uid) }}">主页</a></li>
                                {% if g.username in g.api.user_get_admins().data %}
                                <li><a href="{{ url_for('admin.index') }}">后台</a></li>
                                {% endif %}
                                <li class="divider"></li>
                                <li><a href="{{ url_for('front.userSet') }}" title="Setting" target="_blank">设置</a></li>
                                <li><a href="{{ url_for('logout') }}" title="Sign Out">登出</a></li>
                            </ul>
                        </li>
                        {% else %}
                        <li><a href="{{ url_for('login') }}" title="Sign In">登录</i></a></li>
                        <li><a href="{{ url_for('signup') }}" title="Sign Up">注册</a></li>
                        {% endif %}
                    </ul>
                </div>
            </nav>
        </div>
    </div>
    <!--
    <div class="row clearfix">
        <div class="col-md-12 column">
            //首页轮番图
            {% block AlternateDiagramClosed %}{% endblock %}
        </div>
    </div>
    -->
    {% block AlternateDiagramBody %}{% endblock %}
    <div class="row clearfix">
        <div class="col-md-8 column">
            <!-- 路径导航 -->
            {% block PathNavigation %}{% endblock %}
            <!-- 公告 -->
            {% block noticeclosed %}{% endblock %}
            <!-- 搜索 -->
            {% block search %}
            <form class="form-search form-horizontal" id="SearchForm" method="GET" action="{{ url_for('front.blogSearch') }}" target="_blank">
                <div class="input-group search-input-group">
                    <button type="submit" style="height: 30px;" class="btn btn-success"><i class="saintic-icon saintic-icon-search"></i></button>
                    <input type="text" name="q" id="input" placeholder="站内搜索" value="{{ request.args.get('q','') }}">
                    <input type="hidden" name="cc" value="saintic.com">
                </div>
            </form>
            {% endblock %}
            {% block container %}{% endblock %}
        </div>
        <!-- 右侧 -->
        {% block aside %}
        <div class="col-md-4 column">
            <!-- 推荐文章列表 -->
            <h4><scan class="saintic-icon saintic-icon-recommended-2 icon-large"></scan> 推荐文章</h4>
            <div class="row clearfix">
                <div class="col-md-12 column">
                    <ul class="list-unstyled">
                    {% for blog in g.api.blog_get_recommend_data().data %}
                        <li><a href="{{ url_for('front.blogShow', bid=blog.id) }}">{{ blog.title }}</a></li>
                    {% endfor %}
                    </ul>
                </div>
            </div>
            <!-- 标签云 -->
            <h4><scan class="saintic-icon saintic-icon-tags saintic-icon-1"> 标签云集</scan></h4>
            <div class="row clearfix">
                <div class="col-md-12 column">
                    {%- set tags = g.api.blog_get_tags_list().data %}
                    <div id="tagscloud">
                    {%- for tag in tags %}
                        <a href="{{ url_for('front.blogResource', resource_type='tag', resource_data=tag) }}" title="查看 {{ tag }} 标签下的文章" class="{{TagRandomColor()}}">{{ tag }}</a>
                    {%- endfor -%}
                    </div>
                </div>
            </div>
            <!-- 友情链接 -->
            <h4><scan class="saintic-icon saintic-icon-link saintic-icon-1"> 友情链接</scan>&nbsp;&nbsp;<small><a href="mailto:{{ g.config.about_email }}?subject=%e7%94%b3%e8%af%b7%e5%8f%8b%e6%83%85%e9%93%be%e6%8e%a5%e4%ba%a4%e6%8d%a2&body=%e8%af%b7%e5%85%88%e6%b7%bb%e5%8a%a0%e6%9c%ac%e7%ab%99%e4%b8%ba%e5%8f%8b%e6%83%85%e9%93%be%e6%8e%a5%ef%bc%8c%e5%9c%a8%e9%82%ae%e4%bb%b6%e4%b8%ad%e5%86%99%e6%98%8e%e6%82%a8%e7%9a%84%e7%ab%99%e7%82%b9%e3%80%82">交换友链</a></small></h4>
            <div class="row clearfix">
                <div class="col-md-12 column">
                    {% for fl in g.api.get_sys_friendlink().data %}
                        <p class="text-success"><scan class="saintic-icon saintic-icon-link-exchange"></scan>&nbsp;<a href="{{ fl.link }}" title="{{ fl.title }}" target="_blank">{{ fl.title }}</a></p>
                    {% endfor %}
                </div>
            </div>
            <!-- 推广 -->
            <h4><scan class="saintic-icon saintic-icon-ad saintic-icon-1"> 推广位</scan></h4>
            <div class="row clearfix">
                <div class="col-md-12 column">
                    <p><a href="https://promotion.aliyun.com/ntms/act/ambassador/sharetouser.html?userCode=rxnbx8o5&utm_source=rxnbx8o5" target="_blank">免费领取阿里云优惠券！</a></p>
                </div>
                {% block asideAd %}{% endblock %}
            </div>
        </div>
        {% endblock %}
    </div>
</div>

<div id="footer" class="container">
<nav class="navbar navbar-default text-center">
    <div class="navbar-inner navbar-content-center">
        <p class="text-muted credit" style="padding: 10px;">
            {% if g.config.about_beian %}
            <a href="http://www.beian.miit.gov.cn/" target="_blank" title="ICP备案号">{{ g.config.about_beian }}</a>&nbsp;
            {% endif %}
            <scan class="saintic-icon saintic-icon-sitemap text-muted"></scan></scan>&nbsp;<a href="{{ url_for('front.sitemaphtml') }}">站点地图</a>&nbsp;
            {% if g.config.status_url %}
            <scan class="saintic-icon saintic-icon-success text-muted"></scan>&nbsp;<a href="{{ g.config.status_url }}" target="_blank" title="SaintIC Status">服务状态</a>&nbsp;
            {% endif %}
            <br/>
            Copyright &copy; 2017-<script>document.write( new Date().getFullYear() );</script>.&nbsp;All rights reserved.&nbsp;Powered by <a href="https://github.com/staugur/EauDouce" target="_blank">EauDouce.</a>
            {{ emit_tep('base_front_footer') }}
        </p>
    </div>
</nav>
</div>

<div id="goTopBtn"></div>
<script src='/static/js/tagscloud.js' type="text/javascript"></script>
<script src="{{ url_for('static', filename='js/jquery-3.1.0.min.js') }}"></script>
<script src="{{ url_for('static', filename='js/bootstrap.min.js') }}"></script>
{% if request.endpoint != "front.index" %}
<script src="{{ url_for('static', filename='layer/layer.js') }}"></script>
{% endif %}
{% block script %}{% endblock %}
{{ emit_tep('base_front_script') }}
<script type="text/javascript">
$(document).ready(function(){
    dropdownOpen();//调用
});

function dropdownOpen() {
    /*
    * 鼠标划过就展开子菜单，免得需要点击才能展开
    */
    var $dropdownLi = $('li.dropdown');
    $dropdownLi.mouseover(function() {
        $(this).addClass('open');
    }).mouseout(function() {
        $(this).removeClass('open');
    });
}

function search(){
    var v = document.getElementById("input").value;
    console.log(v,!v)
    if (!v) {
        return false;
    } else {
        var f = document.getElementById("SearchForm");
        f.action = f.action+"?q=" + v;
        window.location.href=f.action;
    }
}

//返回顶部
$(window).scroll(function(){
    var sc=$(window).scrollTop();
    var rwidth=$(window).width()
    if(sc>0){
        $("#goTopBtn").css("display","block");
        $("#goTopBtn").css("left",(rwidth-36)+"px");
    }else{
        $("#goTopBtn").css("display","none");
    }
})
$("#goTopBtn").click(function(){
    var sc=$(window).scrollTop();
    $('body,html').animate({scrollTop:0},500);
})
</script>  
</body>
</html>
